/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2022-10-07
 * Time:22:03
 */

/**
 * 力扣1752:检测数组是否经排序和轮转得到
 */

public class check {
    public boolean check(int[] nums) {
        int count = 0;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] < nums[i - 1]) {
                count++;
                if (count > 1) {
                    return false;
                }
            }
        }
        if (count == 1) {
            return nums[nums.length-1] <= nums[0];
        }
        return true;
    }
}
